//package com.aiti.lulian.service.impl;
//
//
//import cn.hutool.core.util.StrUtil;
//import com.aiti.base.core.base.service.iml.BaseSerivceImpl;
//import com.aiti.base.core.utils.message.Message;
//import com.aiti.lulian.constant.NotificationConstant;
//import com.aiti.lulian.entity.LatestDealNews;
//import com.aiti.lulian.entity.MsgInbox;
//import com.aiti.lulian.mapper.LatestDealNewsMapper;
//import com.aiti.lulian.mapper.MsgInboxMapper;
//import com.aiti.lulian.service.LatestDealNewsService;
//import com.aiti.lulian.service.MsgInboxService;
//import com.aiti.lulian.utils.NotificationUtils;
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Lazy;
//import org.springframework.stereotype.Service;
//
//import java.util.HashMap;
//import java.util.Map;
//
//@Service
//public class LatestDealNewsServiceImpl extends BaseSerivceImpl<LatestDealNewsMapper, LatestDealNews> implements LatestDealNewsService {
//
//    @Autowired
//    @Lazy
//    private NotificationUtils notificationUtils;
//
//    @Override
//    public Message saveLatestDealNews(LatestDealNews latestDealNews) {
//        String baseId = latestDealNews.getBaseId();
//        if(StringUtils.isEmpty(baseId)){
//            this.save(latestDealNews);
//        }else{
//            this.updateById(latestDealNews);
//        }
//        String recordBaseId = latestDealNews.getBaseId();
//        LatestDealNews record = this.getById(recordBaseId);
//
//        if(StringUtils.isEmpty(baseId)){
//            notificationUtils.sendBroadcastMessage(record, "new");
//        }else{
//            notificationUtils.sendBroadcastMessage(record, "update");
//        }
//        return Message.success();
//    }
//
//
//    @Override
//    public Message detail(String baseId) {
//        LatestDealNews dealNews = this.getById(baseId);
//        return Message.success(dealNews);
//    }
//
//    @Override
//    public Message deleteDeal(String baseId) {
//        LatestDealNews record = this.getById(baseId);
//        notificationUtils.sendBroadcastMessage(record, "delete");
//        this.removeById(baseId);
//        return Message.success();
//    }
//
//    @Override
//    public Message dealPage(Page page, LatestDealNews latestDealNews) {
//        LambdaQueryWrapper<LatestDealNews> wrapper = new LambdaQueryWrapper<>();
//        wrapper.like(!StringUtils.isEmpty(latestDealNews.getName()), LatestDealNews::getName, latestDealNews.getName())
//                .orderByDesc(LatestDealNews::getBaseCreateTime);
//        Page resultPage = this.page(page, wrapper);
//        return Message.success(resultPage);
//    }
//
//
//}
